﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UtilZ.Dotnet.Ex.Log;
using UtilZ.Dotnet.Ex.Model;

namespace ConAppCore.Test
{
    internal class TestGISTrailGenerator
    {
        public static void Test()
        {
            var segments = new List<GISTrailSegment>();
            segments.Add(new GISTrailSegment(new GISPoint3(30, 40, 50), new GISPoint3(60, 70, 80), 3));
            segments.Add(new GISTrailSegment(new GISPoint3(60, 70, 80), new GISPoint3(40, 20, 800), 4));
            segments.Add(new GISTrailSegment(new GISPoint3(40, 20, 800), new GISPoint3(30, 40, 50), 3));
            var trailGenerator = new GISTrailGenerator(segments);

            //List<GISPoint3> points = new List<GISPoint3>();
            //points.Add(new GISPoint3(30, 40, 50));
            //points.Add(new GISPoint3(60, 70, 80));
            //points.Add(new GISPoint3(40, 20, 800));
            //points.Add(new GISPoint3(30, 40, 50));
            //var trailGenerator = GISTrailGenerator.CreateTrailGenerator(points, 10, 5, 20);

            //string trailStr = "(86.88,28.91)-(87.589,29.652)-100|(87.589,29.652)-(88.758,30.242)-100|(88.758,30.242)-(90.596,29.601)-100|(90.596,29.601)-(91.455,27.973)-100|(91.455,27.973)-(90.385,26.197)-100|(90.385,26.197)-(88.998,25.766)-100|(88.998,25.766)-(87.142,26.164)-100|(87.142,26.164)-(86.88,28.91)-100";
            //string trailStr = "(86.88,28.91)-(87.589,29.652)*100|(87.589,29.652)-(88.758,30.242)*100|(88.758,30.242)-(90.596,29.601)*100|(90.596,29.601)-(91.455,27.973)*100|(91.455,27.973)-(90.385,26.197)*100|(90.385,26.197)-(88.998,25.766)*100|(88.998,25.766)-(87.142,26.164)*100|(87.142,26.164)-(86.88,28.91)*100";
            //GISTrailGenerator trailGenerator;
            //if (!GISTrailGenerator.TryParse(trailStr, out trailGenerator))
            //{
            //    Console.WriteLine("解析轨迹字符串失败.");
            //    return;
            //}

            GISPoint3 point3;

            for (int i = 0; i < 3; i++)
            {
                while (trailGenerator.TryNext(out point3))
                {
                    Console.WriteLine(point3);
                }

                trailGenerator.Reset();
                Console.WriteLine("---------------Reset-----------------");
            }


            /*******************************************
             * 
             * 经度:30,纬度:40,高度:50
             * 经度:40,纬度:50,高度:60
             * 经度:50,纬度:60,高度:70
             * 
             * 经度:60,纬度:70,高度:80
             * 经度:55,纬度:57.5,高度:260
             * 经度:50,纬度:45,高度:440
             * 经度:45,纬度:32.5,高度:620
             * 
             * 经度:40,纬度:20,高度:800
             * 经度:36.666666666666664,纬度:26.666666666666668,高度:550
             * 经度:33.33333333333333,纬度:33.333333333333336,高度:300
             * 经度:30,纬度:40,高度:50
             * 
             *******************************************/

        }

    }
}
